package com.example.service.impl;

import com.example.pojo.stu;
import com.example.service.UserService;
import com.example.utils.ExcelUtils;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;

@Service
public class UserServiceImpl implements UserService {
    @Override
    public void ExcelExport(HttpServletResponse response) throws IOException {
        String filename = "info" + new SimpleDateFormat("yyyy-MM-dd-HHmmss").format(System.currentTimeMillis());
        List<stu> stus = new LinkedList<stu>();
        stu stu = new stu("wzw","SH");
        stu stu1 = new stu("wzw1","SH1");
        stu stu2 = new stu("wzw2","SH2");
        stus.add(stu);
        stus.add(stu2);
        stus.add(stu1);
        new ReentrantLock();
//        ExcelUtils.exportExcel(stus, com.example.pojo.stu.class,"info",null,response);
        ExcelUtils.exportExcel(stus,"info","info", com.example.pojo.stu.class,"info table",response);
    }

}
